<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app"></div>
    <!-- 加载 React。-->
    <!-- 注意: 部署时，将 "development.js" 替换为 "production.min.js"。-->
    <script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script>
    <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" crossorigin></script>
    <!-- 加载babel -->
    <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>

    <script type="text/babel">
        
        let message = "hello world";
        function huantext(){
            message = "hello React";
            console.log(message);
            render();
        }
        function render() {
            ReactDOM.render(
                <div>
                    <h1>{message}</h1>
                    <button onClick={huantext}>点击换字</button>
                </div>,
                document.getElementById("app")
            )
        }
        render();
    </script>
</body>
</html>